Add native support for deletion protection - #440
Merged
Conversation
This replaces the https://github.com/serverless-guru/serverless-termination-protection plugin that is no longer maintain and makes it a first-party feature.
GrahamCampbell
force-pushed
the
feature/deletion-protection
branch
from
August 23, 2026 20:12
9119fc2 to
815b7c5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This supersedes #418 and keeps its four commits from @mnapoli as they were, rebased onto 4.x, followed by one commit with the changes that came out of review.
Deletion protection now lives in its own internal plugin, mirroring
provider.pruneFunctionVersions: it validates the configuration before the deploy and sets the stack's termination protection onafter:deploy:deploy, which covers every terminal deploy path, including deploys skipped because nothing changed, while leavingrollbackanddeploy functionalone, so those commands no longer needcloudformation:UpdateTerminationProtection. Values that slip past schema validation underconfigValidationMode: warnorofffail withINVALID_DELETION_PROTECTION_CONFIGbefore anything is uploaded instead of silently disabling protection, an SDK failure after an otherwise successful stack update is reported as such, and a first change-set deploy that ends with an empty change set no longer protects a stack left inREVIEW_IN_PROGRESS.The remove guard warns and continues when
DescribeStacksis denied, its message covers thestagesform and the AWS CLI escape hatch, and the ECR repository probe runs concurrently again. The docs spell out that unlisted stages are actively unprotected, which differs from the plugin this replaces, plus the IAM permissions, the first-deploy window and thedeploy --packagecaveat. The schema moved to a namedawsDeletionProtectiondefinition and the unrelated type reflows were dropped.